import http from '@/axios/http.ts'
import {
    createArticleInfoRequest,
    articleQueryRequest,
    updateArticleInfoRequest
} from '@/models/articleModel'

/**
 * 创建文章
 * @param {*} p 
 * @returns 
 */
export const createArticle = (parmas: createArticleInfoRequest) => {
    return http.post('/Article/CreateArticle', parmas);
}

/**
 * 获取文章列表
 * @param {*} p 
 * @returns 
 */
export const getArticleList = (parmas: articleQueryRequest) => {
    return http.get('/Article/GetArticleList', parmas);
}

/**
 * 根据id获取文章预览内容
 * @param {*} p 
 * @returns 
 */
export const getArticleContentById = (parmas: String) => {
    return http.get('/Article/GetArticleContentById', parmas);
}

/**
 * 根据id获取文章信息
 * @param {*} p 
 * @returns 
 */
export const getArticleInfoById = (parmas: String) => {
    return http.get('/Article/GetArticleInfoById', parmas);
}

/**
 * 修改文章
 * @param {*} p 
 * @returns 
 */
export const updateArticle = (parmas: updateArticleInfoRequest) => {
    return http.post('/Article/UpdateArticle', parmas);
}
//
/**
 * 删除文章
 * @param {*} p 
 * @returns 
 */
export const deleteArticleById = (parmas: String) => {
    return http.del('/Article/DeleteArticleById', parmas);
}